var startMEM;
var startCPU;
$(document).ready(function() {
    menuClass("capacity");        
    var codigo_capacity = $('#hdncodigo').val();    
    if(codigo_capacity === 'new') {
        $('#btnlunes').addClass("active");
        startCPU = 10;
        startMEM = 10;
        $('#sel-hini-hs').val(10);
        $('#sel-hini-min').val(00);
        $('#sel-hfin-hs').val(10);
        $('#sel-hfin-min').val(00);        
    } else {
        $.ajax({
            url: '/admin/capacity/getinfo',
            type: 'post',
            dataType: 'json',        
            data : {
                'codigo_configuracion_encendido_global': $('#hdncodigo').val()            
            },        
            success: function(data) {            
                if (data.tipo === 'error') {
                // desplegar mensaje de error
                } else if (data.tipo === 'success') {
                // desplegar mensaje de success
                }            
            }
    
        });
    }
    
    $('#sld_ram').sGlide({
        height: 10,
        witdh: 20,
        startAt: startMEM,
        image: '/images/knob.png',	
        colorStart: '#bbbbbb',
        colorEnd: '#bbbbbb',	
        drag: function(o){
            var pct = Math.round(o.value)+'%';
            $('#pct_cpu').html(pct);
        },
        onButton: function(o){
            var pct = Math.round(o.value)+'%';
            $('#pct_cpu').html(pct);
        }
    });
    $('#sld_cpu').sGlide({
        height: 10,
        startAt: startCPU,
        image: '/images/knob.png',	
        colorStart: '#bbbbbb',
        colorEnd: '#bbbbbb',	        
        drag: function(o){
            var pct = Math.round(o.value)+'%';
            $('#pct_mem').html(pct);
        },
        onButton: function(o){
            var pct = Math.round(o.value)+'%';
            $('#pct_mem').html(pct);
          
        }
    });
});

function cancelar() {
    //window.location.href = '/admin/capacity/'
    
//    $("#btnlunes").removeClass('ac')
//                <a href="#" id="btnmartes" class="btn" data-toggle="tab">Martes</a>
//                <a href="#" id="btnmiercoles" class="btn" data-toggle="tab">Miercoles</a>
//                <a href="#" id="btnjueves" class="btn"  data-toggle="tab">Jueves</a>
//                <a href="#" id="btnviernes" class="btn"  data-toggle="tab">Viernes</a>
//                <a href="#" id="btnsabado" class="btn"  data-toggle="tab">Sabado</a>
//                <a href="#" id="btndomingo
    $('#btnlunes').removeClass("active");
    $('#btnmartes').removeClass("active");
    $('#btnmiercoles').removeClass("active");
    $('#btnjueves').removeClass("active");
    $('#btnviernes').removeClass("active");
    $('#btnsabado').removeClass("active");
    $('#btndomingo').removeClass("active");
    $('#sel-hini-hs').val(0);
    $('#sel-hini-min').val(0);
    $('#sel-hfin-min').val(0);
    $('#sel-hfin-hs').val(0);    
    $('#sld_ram').sGlide('startAt', 0);
    $('#sld_cpu').sGlide('startAt', 0);
    $('#pct_mem').html(0);    
    $('#pct_cpu').html(0);    

}